import { createApp } from "vue";
import App from "./App.vue";
import router from './router/index.js'
// import "~/styles/element/index.scss";
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import ElementPlus from "element-plus";
// import all element css, uncommented next line
import "element-plus/dist/index.css";
// import "element-plus/theme-chalk/src/index.scss";
// or use cdn, uncomment cdn link in `index.html`
import "~/styles/index.scss";
import "uno.css";

// If you want to use ElMessage, import it.
import "element-plus/theme-chalk/src/message.scss";
// import { createPinia } from 'pinia';
// import pinia from '@/store/wmsGlobal'
import pinia from '@/store/asPinia'
import wmsTable from '@/components/table/table.vue'
import editTableBody from '@/components/table/editTableBody.vue'
import tableWhere from '@/components/table/tableWhere.vue'
import { GET } from '@/components/utils/http'
import { groupBy } from '@/components/utils/api'
const app = createApp(App);
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}

app.use(pinia)
import { useWmsGlobal } from '@/store/wmsGlobal'
const wmsGlobal = useWmsGlobal();
GET('/Menu/getOptions', {}).then((data) => {
    wmsGlobal.wmsOptions = groupBy('wms_field',data.data);
})

app.use(ElementPlus);
app.use(router)
app.component("wms-table", wmsTable)
app.component("edit-table", editTableBody)
app.component("table-where", tableWhere)
app.mount("#app");
